/**
 * https://leetcode.cn/problems/partition-array-into-disjoint-intervals/submissions/590075315/
 * 915.分割数组
 * medium 2024.12.29
 * 优先队列
 */

class Solution {
public:
    int partitionDisjoint(vector<int>& nums) {
        int m=nums[0];
        int t=0;
        for(int i=1;i<nums.size();++i){
            if(nums[i]<nums[0]){
                t=i;
                nums[0]=m;
            }
            m=max(nums[i],m);
        }
        return t+1;
    }
};